<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>基本布局</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
        }
        #main{
           position: relative;
            border: 1px solid #ccc;
            width: 300px;
            height: 350px;
            margin: 0px auto;
            background-color: #ccc;
        }
        #stage{
            background-color: white;
            width: 300px;
            height: 300px;
        }
        #control{
            background-color: white;
            border: 1px solid #ccc;
            text-align: center;
            height: 25px;
        }
        button{
            margin: 0px 10px;
        }
        #food{
            position: absolute;
            width: 15px;
            height: 15px;
            border: 1px solid red;
        }
        #snake>div{
            position: absolute;
            width: 15px;
            height: 15px;
            border: 1px solid black;
        }
    </style>
</head>
<body>
    <div id="main">
        <div id="stage">
            <div id="snake" >
                <div style="top: 30px;left: 30px;"></div>
                <div style="top: 45px;left: 30px;"></div>
                <div style="top: 60px;left: 30px;"></div>
            </div>
            <div style="left: 15px;" id="food"></div>
        </div>
        <div id="control">
            <button id="start">start</button>
            <button id="end">end</button>

        </div>
        <div id="info">11</div>
    </div>
    <script>
        start.onclick = function()
        {
            console.log(food.style.left);
            
            food.style.left = "30px"
        }
    </script>
</body>
</html>